<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>无标题文档</title>
	<link href="/static/css/default.css" rel="stylesheet" type="text/css">
	<link href="/static/css/style/green.css" rel="stylesheet" type="text/css" id='link'>
	<link href="/static/js/datepicker/css/bootstrap-datepicker.css" rel="stylesheet">
</head>

<body style="padding:15px 8px 0px 8px;">



	<div class="classify">{$parenttitle}</div>
	<!--toolbar start-->
	<ul class="toolbar">

		<li>学号：<input type="text" class="forminput inputstyle" id="number" value="{$number}"></li>
		<li>姓名<input type="text" class="forminput inputstyle" id="truename" value="{$truename}"></li>
		<li>班级

			<select type="text" id="classid" class="select" v-model="classid">
				<option value="">
					请选择
				</option>
				<option v-for="item in list" :value='item.id'>
					{{item.classname}}
				</option>
			</select>
		</li>
		<li><input type="checkbox" id="state" value="-1" />已结业</li>
		<li><a href="#" class="selected" id="search">查询</a></li>
		<li><a href="#" class="selected" id="clear">重置</a></li>
	</ul>
	<ul class="toolbar">
		<li><a href="#" class="selected" id="add"><i class="toolico iconfont">&#xe649;</i>添加</a></li>
		<li><a href="#" class="selected" id="import">导入数据</a></li>
		<li style="float:right"><a href="#" class="selected" id="export">导出</a></li>
	</ul>
	<!--toolbar end-->

	<!--tablebox start-->
	<div class="tablebox" id="main">

		<table>

			<thead>
				<th class="num"></th>
				<th>学号</th>
				<th>姓名</th>
				<th>性别</th>
				<th>班级</th>
				<th>爸爸</th>
				<th>爸爸手机</th>
				<th>妈妈</th>
				<th>妈妈手机</th>
				<th>紧急联系方式</th>
				<th>直播到期时间</th>
				<th>是否结业</th>
				<th>是否绑定微信</th>
				<th>操作</th>
			</thead>

			<tbody>


				<tr v-for="uitem in arrayData">
					<td><input type="checkbox"></td>

					<td>{{uitem.number}}</td>
					<td>{{uitem.truename}}</td>
					<td>{{uitem.sex}}</td>
					<td>{{uitem.classname}}</td>
					<td>{{uitem.fathername}}</td>
					<td>{{uitem.fatherphone}}</td>
					<td>{{uitem.mothername}}</td>
					<td>{{uitem.motherphone}}</td>
					<td>{{uitem.otherphone}}</td>
					<td>{{uitem.videoetime}}</td>
					<td>
						<span v-if="uitem.state==0">否</span>
						<span v-if="uitem.state==-1">是</span>
					</td>
					<td>
						<a v-on:click="bind(uitem)" v-if="uitem.isbind=='是'" style="color:blue">{{uitem.isbind}}</a>
						<a v-if="uitem.isbind=='否'">{{uitem.isbind}}</a>
					</td>
					<td>
						<div class="am-btn-toolbar">
							<div class="am-btn-group am-btn-group-xs">
								<a v-on:click="card(uitem)">卡管理</a>
								<a v-on:click="vupdate(uitem)">修改</a>
								<a v-on:click="vdel(uitem)">删除</a>
							</div>
						</div>
					</td>
				</tr>
				</tr>



			</tbody>

		</table>

		<div class="pagination">


			<vue-nav :cur="cur" :all="all" :allcount="allcount" :callback="callback"></vue-nav>

		</div>
	</div>
	<!--tablebox end-->

	<!--pagination start-->


	<!--pagination end-->

</body>
<script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>

<script src="/static/js/layer/layer.js"></script>

<script type="text/javascript" src="/static/js/vue2.js"></script>
<script type="text/javascript" src="/static/js/vue-nav.js"></script>
<script>
	var classid = "{$info.classid}";


	var menu = new Vue({
		el: '#classid',
		data: {
			classid: classid,
			list: []
		},
		methods: {
			getdata: function () {
				var _self = this;//保存this的指向

				$.get('/Index/Myclass/GetMyClassList', function (data) {
					_self.list = data;
				});
			}

		},
		created: function () {  //初始化事件里边去调用查询方法
			this.getdata();
		}
	});
	var vm = new Vue({
		el: "#main",
		data: {
			cur: 1,
			all: 0,
			size: 10,
			allcount: 0,
			arrayData: [],

		},
		components: {
			'vue-nav': Vnav
		},
		methods: {
			getdata: function (_keycontent) {  //查询数据

				var self = this;
				var number = $("#number").val();
				var truename = $("#truename").val();
				var classid = $("#classid").val();
				var state = "";
				if ($('#state').is(':checked')) {
					state = "-1";
				} else {
					state = "0";
				}



				$.get("/Index/Student/GetStudent", { page: self.cur, size: self.size, number: number, truename: truename, classid: classid, state: state }, function (_result) {
					self.arrayData = _result.list;
					self.all = _result.count;
					self.allcount = _result.allcount
				});

			},
			callback: function (data) {

				var self = this;
				this.cur = data;
				var number = $("#number").val();
				var truename = $("#truename").val();
				var classid = $("#classid").val();
				var state = "";
				if ($('#state').is(':checked')) {
					state = "-1";
				} else {
					state = "0";
				}

				$.get("/Index/Student/GetStudent", { page: self.cur, size: self.size, number: number, truename: truename, classid: classid, state: state }, function (_result) {

					self.arrayData = _result.list;
					self.all = _result.count;
					self.allcount = _result.allcount
				});
			},

			bind: function (uitem) {
				parent.layer.open({
					type: 2,
					title: '绑定',
					fixed: false, //不固定
					maxmin: true,
					area: ['600px', '550px'],
					content: '/Index/Student/bind?id=' + uitem.id
				});
			},
			card: function (uitem) {
				parent.layer.open({
					type: 2,
					title: '卡管理',
					fixed: false, //不固定
					maxmin: true,
					area: ['600px', '550px'],
					content: '/Index/Student/card?id=' + uitem.id
				});
			},
			vupdate: function (uitem) {

				//***************获取数据的方法1，使用jquery获取*****************

				parent.layer.open({
					type: 2,
					title: '信息修改',
					fixed: false, //不固定
					maxmin: true,
					area: ['600px', '550px'],
					content: '/Index/Student/Add?id=' + uitem.id
				});

			},
			vdel: function (uitem) {
				var self = this;
				parent.layer.confirm('确定要删除吗?', {
					btn: ['是', '否'] //按钮
				}, function () {
					parent.layer.closeAll('dialog');
					$.post("/Index/Student/Del", { "id": uitem.id }, function (data) {
						if (data.status == 200) {
							layer.msg(data.message);
							self.getdata("");
						} else {
							layer.msg(data.message);
						}
					});
				}, function () {

				});

			}
		},
		created: function () {  //初始化事件里边去调用查询方法
			this.getdata("");
		}
	});



	$('#import').on('click', function () {

		parent.layer.open({
			title: '数据导入',
			type: 2,
			area: ['800px', '650px'],
			fixed: false, //不固定
			maxmin: true,
			content: '/Index/Home/importstudent'
		});
	});

	$('#export').on('click', function () {
		var number = $("#number").val();
		var truename = $("#truename").val();
		var classid = $("#classid").val();
		var state = "";
		if ($('#state').is(':checked')) {
			state = "-1";
		} else {
			state = "0";
		}
		window.open("/Index/Student/exportstudent?number="+number+"&truename="+truename+"&classid="+classid+"&state="+state);
	});


	$('#add').on('click', function () {

		parent.layer.open({
			title: '信息添加',
			type: 2,
			area: ['600px', '550px'],
			fixed: false, //不固定
			maxmin: true,
			content: '/Index/Student/Add'
		});
	});
	$("#search").click(function () {

		vm.getdata("");
	});

	$("#clear").click(function () {
		$("#number").val("");
		$("#truename").val("");
		$("#classid").val("");

	});




</script>

</html>